package com.wyh.domain.po.groupOne.organization;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;

/**
 * 组织表
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MasterDataOrganization implements Serializable {
    /**
     * 组织id
     */
    @ApiModelProperty(value = "组织id", required = true)
    private Integer id;
    /**
     * 姓名
     */
//    @NotBlank(message = "企业名称不能为空")
    @Size(max = 50, min = 10, message = "组织名称必须为10-50个字符")
    @ApiModelProperty("组织名称")
    @Length(max = 50, min = 10, message = "组织名称必须为10-50个字符")
    @NotNull(message = "组织名称不能为空")
    private String name;
    /**
     * 上级组织id
     */
//    @NotBlank(message = "[上级组织id]不能为空")
    @NotNull(message = "上级组织id不能为空")
    @ApiModelProperty(value = "上级组织id", required = true)
    private Integer superiorid;
    /**
     * 统一社会信用码
     */
    @Size(max = 255, message = "编码长度不能超过255")
    @ApiModelProperty(value = "统一社会信用码", required = true)
    @Length(max = 255, message = "编码长度不能超过255")
    @Pattern(regexp = "^[A-Za-z0-9]{18}$", message = "统一社会信用码需为18位数字或英文字符")
    private String creditcode;
    /**
     * 开户行
     */
    @Size(min = 10, max = 50, message = "开户银行名称长度需在10到50字符之间")
    @ApiModelProperty(value = "开户行", required = true)
    @Length(min = 10, max = 50, message = "开户银行名称长度需在10到50字符之间")
    private String openingbank;
    /**
     * 银行账号
     */
    @Size(max = 25, message = "银行账号需为12到25位数字", min = 12)
    @ApiModelProperty(value = "银行账号", required = true)
    @Length(max = 25, message = "银行账号需为12到25位数字", min = 12)
    @Pattern(regexp = "^\\d{12,25}$", message = "银行账号需为12到25位数字")
    private String bankaccount;
    /**
     * 注册区域
     */
    @Size(max = 255, message = "编码长度不能超过255")
    @ApiModelProperty(value = "注册区域", required = true)
    @Length(max = 255, message = "编码长度不能超过255")
    private String registrationarea;
    /**
     * 详细地址
     */
    @Size(max = 40, message = "详细地址长度不能超过40字符")
    @ApiModelProperty(value = "详细地址", required = true)
    @Length(max = 40, message = "详细地址长度不能超过40字符")
    private String detailedaddress;
    /**
     * 联系电话1
     */
    @Size(max = 255, message = "编码长度不能超过255")
    @ApiModelProperty("联系电话1")
    @Length(max = 255, message = "编码长度不能超过255")
    private String telephone1;
    /**
     * 联系电话2
     */
    @Size(max = 255, message = "编码长度不能超过255")
    @ApiModelProperty("联系电话2")
    @Length(max = 255, message = "编码长度不能超过255")
    private String telephone2;
    /**
     * 联系电话3
     */
    @Size(max = 255, message = "编码长度不能超过255")
    @ApiModelProperty("联系电话3")
    @Length(max = 255, message = "编码长度不能超过255")
    private String telephone3;

    /**
     * 联系电话，采用集合存储，应对多个电话的情况
     */
    @Size(max = 3, message = "企业电话最多3个")
    @ApiModelProperty(value = "新增组织的电话数组，可传三个", required = true)
    private List<@Pattern(regexp = "^\\d{8,15}$", message = "企业电话长度需在8到15位之间") String> telephone;

    /**
     * 是否为开票组织
     */
    @ApiModelProperty("是否为开票组织")
    @JsonProperty(value = "Isinvoicing", required = true)
    private Integer Isinvoicing;
    /**
     * 状态，0停用、1启用
     */
    @ApiModelProperty("状态，0停用、1启用")
    private Integer state;

    /**
     * 树的子节点
     */
    @ApiModelProperty("组织的下级组织")
    private List<MasterDataOrganization> organizationsChildren;

    /**
     * 上级组织名称
     */
    @ApiModelProperty("上级组织名称")
    private String superiorName;
}
